// 创建vuex store
import Vuex from 'vuex'
import Vue from 'vue'

Vue.use(Vuex)
// Vue.prototype就灌入了 vuex对象 $store
// 创建仓库
const store = new Vuex.Store({
  state: {
    num:1,
    num2:10
  },
  mutations: {
    addNum (state, {p1,p2}) {
      state.num+=p2
    },
    reduceNum (state) {
      state.num--
    }
  }
})

export default store